package cn.ncupyh.polymorphism;

public class Test {
    public static void main(String[] args) {
        /*4.定义测试类(完成以下打印效果):
    keepPet(Dog dog,String somethind)方法打印内容如下:
        年龄为30岁的老王养了一只黑颜色的2岁的狗
        2岁的黑颜色的狗两只前腿死死的抱住骨头猛吃
    keepPet(Cat cat,String somethind)方法打印内容如下:
        年龄为25岁的老李养了一只灰颜色的3岁的猫
        3岁的灰颜色的猫眯着眼睛侧着头吃鱼*/
        Person p1 = new Person("老王",30);
        //大写:ctrl + shift + u;
        Person p2 = new Person("老李", 25);
        Animal d = new Dog(2,"黑颜色");
        Animal c = new Cat(3,"灰颜色");
        p1.keepPet((Dog) d,"骨头");
        p2.keepPet((Cat) c,"鱼");
    }

}
